package cn.wolfcode.producer._3_consumer;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;

public class Producer {

    public static void main(String[] args) throws Exception{
        DefaultMQProducer defaultMQProducer = new DefaultMQProducer("producerDemo");
        defaultMQProducer.setSendMsgTimeout(10000);
        defaultMQProducer.setNamesrvAddr("127.0.0.1:9876");
        defaultMQProducer.start();
        /*producer.setSendMsgTimeout(10000);*/

        Message message = new Message("03-hello","你好RocketMq".getBytes());
        SendResult sendResult = defaultMQProducer.send(message);
        System.out.println(sendResult.getSendStatus());
        System.out.println(sendResult.getMsgId());
        defaultMQProducer.shutdown();
    }



}
